/**
 * @param id - 聊天会话 id，不是班级 id
 */
interface FetchMessageListAPIData {
  id: string
  limit: string
  page: string
}

interface FetchMessageListAPIResData {
  code: number
  msg: string
  time: string
  data: {
    data: Message[]
    current_page: number
    total: number
    per_page: number
    last_page: number
  }
}

/**
 * @description 根据传入的聊天 id，分页获取用户在某个班级中与某个老师的留言（聊天）列表
 */
export function fetchMessageListAPI(data: FetchMessageListAPIData, token: string) {
  return httpInstance.post<FetchMessageListAPIResData, FetchMessageListAPIData>(
    '/api/message/messagedetail',
    data,
    { headers: { token } },
  )
}
